package com.hades.example.java.refactoring.after.c10.c10_14_replace_error_code_with_exception.v2;

import org.junit.Assert;

public class Account {
    int _balance;

    boolean canWithdraw(int amount) {
        return amount <= _balance;
    }

    void withdraw(int amount) {
//        if (amount > _balance) {
//            throw new IllegalArgumentException("Amount too large");
//        }
        Assert.assertTrue("Sufficient funds", amount <= _balance);
        _balance -= amount;
    }
}
